package com.demo11;

public class StudentTest {
    public static void checkScore(int score){
        if(score>100 || score<0){
            //解决方法处理
            try {
                throw new ScoreException("分数格式不正确");
            } catch (ScoreException e) {
                e.printStackTrace();
            }
        }else {
            System.out.println("分数输入正确");
        }
    }

    public static void checkName(String name){
        if(name.length()<=1 || name.length()>3){
            try {
                throw new NameException("输入学生姓名长度有误");
            } catch (NameException e) {
                e.printStackTrace();
            }
        }else {
            System.out.println("姓名输入正确");
        }
    }
}
